package com.perceptivesoftware.licensing.client.dialogs.useradmin;

import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.Composite;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;

public class BreadCrumbs extends Composite
{
	ToolBar tb = new ToolBar();

	public BreadCrumbs()
	{
		initComponent(tb);
	}

	public void setBreadcrumbs(final SecurityManagerNavModel anm, final TreeStore<SecurityManagerNavModel> ts)
	{
		tb.removeAll();
		SecurityManagerNavModel anm2 = anm;
		while (anm2 != null)
		{
			tb.insert(new BreadCrumb(anm2), 0);
			anm2 = ts.getParent(anm2);
			if (anm2 != null)
			{
				tb.insert(new LabelField("&gt;"), 0);
			}
		}
		tb.layout();
	}
}
